package com.company.stream;

/**
 * @Author mahx
 * @Email mahx@gillion.com.cn
 * @Data 2019/12/16 11:24
 * @Version 1
 */
public class Student implements Comparable<Student>{
    private Long studentId;
    private String name;
    private String sex;

    public Student() {
    }

    public Student(Long studentId, String name, String sex) {
        this.studentId = studentId;
        this.name = name;
        this.sex = sex;
    }

    public Long getStudentId() {
        return studentId;
    }

    public void setStudentId(Long studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Student{" +
                "studentId=" + studentId +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }


    @Override
    public int compareTo(Student o) {
        if (o != null) {
            if (this.getStudentId() > o.getStudentId()) {
                return 1;
            } else if (this.getStudentId().equals(o.getStudentId())) {
                return 0;
            }
        }
        return -1;
    }
}
